// GEO MAP

function SWAPGeoMap(panelID, mapID, mapHeaderID, listPanelID, listBoxID, listHeaderID, restoreID, minimizeID){

	 this.panelID = panelID;
	 this.mapID = mapID;
	 this.mapHeaderID = mapHeaderID;
	 this.listBoxID = listBoxID;
	 this.listHeaderID = listHeaderID;
	 this.listPanelID = listPanelID;
	 this.restoreButtonID = restoreID;
	 this.minimizeButtonID = minimizeID;
	 this.SetBlankMapOptions();    
	 this.SetMapOptions(); 
}

SWAPGeoMap.prototype.SetMapOptions = function(){

	this.mapOptions = {}; 
	this.mapOptions['region'] = 'US';
	this.mapOptions['width'] = 400;
	this.mapOptions['height'] = 421;
	this.mapOptions['colors'] = [0xFFC5A1,  0xd04020]; //orange colors
	this.mapOptions['title'] = 'Browse By State';
	this.mapOptions['dataMode'] = 'regions';
	
}

SWAPGeoMap.prototype.SetBlankMapOptions = function(){

	this.bmapOptions = {}; 
	this.bmapOptions['region'] = 'US';
	this.bmapOptions['width'] = 400;
	this.bmapOptions['height'] = 421;
	this.bmapOptions['colors'] = [0xFFF5f1]; //orange colors
	this.bmapOptions['title'] = 'Browse By State';
	this.bmapOptions['dataMode'] = 'regions';
	
}
 

SWAPGeoMap.prototype.DrawBlankGeoMap = function(stateCount, stateList){

	var data = new google.visualization.DataTable();
	    
	data.addColumn('string', 'State');
	data.addColumn('number', 'GCN Species');
	data.addRows(1); 
	
	data.setValue(0,0,'Rhode Island');
	data.setValue(0,1,0); 		
	var geomap = new google.visualization.GeoMap(document.getElementById(this.mapID));
	geomap.draw(data,this.bmapOptions);

}

SWAPGeoMap.prototype.DrawGeoMap = function(data){

 
    var geomap = new google.visualization.GeoMap(document.getElementById(this.mapID));
    google.visualization.events.addListener(geomap, 'regionClick', function(e) {      
		var state = extract_state(e['region']);
		geomap_onclick(state);
			 
    });
	geomap.draw(data,this.mapOptions);
}


SWAPGeoMap.prototype.MinimizeGeoMap = function(){

	$('#' + this.panelID).hide();

	$('#' + this.restoreButtonID).show();
	
}

SWAPGeoMap.prototype.RestoreGeoMap = function(){

	$('#' + this.panelID).show();
	$('#' + this.restoreButtonID).hide();
	 
	
}
	
SWAPGeoMap.prototype.MinimizeList = function(){
	$('#' + this.listPanelID).hide();
}

SWAPGeoMap.prototype.RestoreList = function(){
	$('#' + this.listPanelID).show();
}
		
 
 



 